package org.corey.wyp.command
{
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	
	import mx.controls.Alert;
	import mx.rpc.IResponder;
	
	import org.corey.wyp.business.PropertyManagerDelegate;
	import org.corey.wyp.event.MonthSettingSaveEvent;
	import org.corey.wyp.model.ProperityModelLocator;
	import org.corey.wyp.vo.MonthSetting;
	
	public class MonthSettingSaveCommand implements ICommand,IResponder
	{
		public var _monthSetting:MonthSetting;
		public function MonthSettingSaveCommand()
		{
			
		}
		
		public function execute(event:CairngormEvent):void{
			var saveEvent:MonthSettingSaveEvent=MonthSettingSaveEvent(event);
			var monthSetting:MonthSetting=MonthSetting(saveEvent.data);
			_monthSetting=monthSetting;
			var pm:PropertyManagerDelegate=new PropertyManagerDelegate(this);
			pm.saveMonthSetting(monthSetting);
		}
		
		public function result(event:Object):void{
			var m:MonthSetting=MonthSetting(event.result);
			if(m!=null){
				ProperityModelLocator.getInstance().application.monthSetting=m;
				Alert.show(_monthSetting.id+" monthSetting id");
			}
		}
		
		public function fault(info:Object):void{
			Alert.show("增加信息失败:"+info);
		}

	}
}